<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>设备信息修改</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=e9c5bb62">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=66b457d6">
    <style>
        td {
            width: 110px;
            height: 30px
        }
    </style>


</head>
<body style="text-align:center;margin:15px auto">
<div id="app">
    <div class="text" style=" text-align:center;font-weight:bold;font-size: 30px;">新机入库单</div>
    <table border="1" id="updateTable" style="margin:15px auto;">
        <tr>
            <td>入库编号</td>
            <td><input type="text" id="inboundId" v-model="inboundId" style="border:none"></td>
            <td>入库操作员</td>
            <td><input type="text" id="createUser" v-model="createUser" style="border:none"></td>
            <td>入库日期</td>
            <td><input type="text" id="createTime" v-model="createTime" style="border:none"></td>
            <td>入库区域</td>
            <td><input type="text" id="inboundPlace" v-model="inboundPlace" style="border:none"></td>
        </tr>
        <tr>
            <td>设备类型</td>
            <td><input type="text" id="deviceType" v-model="deviceType" style="border:none"></td>
            <td>设备品牌</td>
            <td>
                <select v-model="brandId" @change="getMod">
                    <option v-for="itemB in itemsBran" v-bind:value="itemB.id">{{itemB.brandName}}</option>
                </select>
            </td>
            <td>设备型号</td>
            <td>
                <select id="testMod" v-model="modelId" @change="getBuc">
                    <option v-for="itemMo in itemsMod" v-bind:value="itemMo.modelId">{{itemMo.modelName}}</option>
                </select>
            </td>
            <td>序列号</td>
            <td><input type="text" id="sequence" v-model="sequence" style="border:none"></td>
        </tr>
        <tr>
            <td>出厂年份</td>
            <td><input type="text" id="year" v-model="year" style="border:none"></td>
            <td>存放地</td>
            <td><input type="text" id="storagePlace" v-model="storagePlace" style="border:none"></td>
            <td>最低限价（万）</td>
            <td>{{itemsLow}}</td>
            <td>斗容</td>
            <td>
                <select id="testBucked" v-model="bucketCapacity" @change="getLow">
                    <option v-for="itemBu in itemsBuc" v-bind:value="itemBu.bucketCapacity">{{itemBu.bucketCapacity}}
                    </option>
                </select>
            </td>
        </tr>
        <tr>
            <td>备注</td>
            <td colspan="7"><input type="text" id="remark" v-model="remark" style="border:none;width:850px;"></td>
        </tr>
    </table>
    <div><input type="button" value="提交" @click="update()" style="width: 80px"></div>

</div>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=0b5caf39"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=0c4d95a9"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<!--oa-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=63aed32f"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<!--ztree组件所需js-->
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="/dist/js/pages/apply/money/class.js"></script>
<script type="text/javascript" src="/dist/js/pages/system/systemService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/commonService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/changeMoneyToChinese.js"></script>
<script type="text/javascript" src="/dist/plugins/print/print.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript">

    var api = frameElement.api, W = api.opener;

    var vm2 = new Vue({
        el: '#app',
        data: {
            itemsBran: [],
            itemsMod: [],
            itemsBuc: [],
            bucketCapacity: '',
            itemsLow: '',

            inboundId: '',
            createUser: '',
            createTime: '',
            inboundPlace: '',
            deviceType: '',
            brandId: '',
            modelId: '',
            sequence: '',
            year: '',
            storagePlace: '',
            remark: '',

        },
        methods: {
            /*选中品牌下拉表时触发此事件,查询该品牌下的型号*/
            getMod(){
                var that = this;
                var s = that.brandId;
                var data = {'brandId': s};
                $.wyui.postMethod('/deviceModel/getModelList.json', data, function (r) {
                    console.log(r);
                    that.itemsMod = r;
                })
            },
            /*选中型号下拉表时触发此事件,查询该型号下的斗容*/
            getBuc(){
                var that = this;
                var s = that.modelId;
                var s2 = that.brandId;
                var data = {'modelId': s, 'brandId': s2};
                $.wyui.postMethod('/deviceModel/getBucketCapacityList.json', data, function (r) {
                    console.log(r);
                    that.itemsBuc = r;
                })
            },
            /*选中斗容下拉表时触发此事件,查询该斗容下的最低报价*/
            getLow(){
                var that = this;
                var s = that.modelId;
                var s2 = that.bucketCapacity;
                var data = {'modelId': s, 'bucketCapacity': s2};
                $.wyui.postMethod('/deviceModel/getLow.json', data, function (r) {
                    console.log(r);
                    that.itemsLow = ((r.lowestPrice) / 10000);
                })

            },

            /*点击提交触发*/
            update(){
                alert("信息修改完毕，是否确认提交");
                var that = this;
                $.wyui.postMethod('/device/updateDevice.json', {
                    id: $.wyui.page.urlParams.id,
                    inboundId: this.inboundId,
                    createUser: this.createUser,
                    createTime: this.createTime,
                    inboundPlace: this.inboundPlace,
                    deviceType: this.deviceType,
                    brandId: this.brandId,
                    modelId: this.modelId,
                    sequence: this.sequence,
                    year: this.year,
                    storagePlace: this.storagePlace,
                    remark: this.remark,

                }, function (r) {
                    console.log(r);
                    if (r.bool) {
                        api.close();
                        location.href = "deviceList.html";
                    } else {
                        alert("修改失败请重新操作");
                    }
                });
            },
        },
        mounted: function () {
            var that = this;
            /*首先显示品牌下拉表*/
            $.wyui.postMethod('/deviceBrand/getBrandList.json', {}, function (r) {
                console.log(r);
                that.itemsBran = r.records;
            });
        }
    });
</script>
</body>
</html>